<?php

class UserDAO extends My_DAO
{
	/** Table name */
    protected $_name    = 'user';
	
	/**
	 * Check username exist
	 *
	 * @param string $username
	 * @return bool
	 */
	public function checkUsernameExist($username)
	{
		$username = $this->getAdapter()->quote($username);
		$select = $this->select()->from($this, array("count" =>   
												new Zend_Db_Expr("count(1)")))
								->where("userName=".$username);
		$row = $this->fetchRow($select);
		if( $row['count'] > 0) {
			return true;		
		}
		return false;
	}

	/**
	 * Check email exist
	 *
	 * @param string $username
	 * @return bool
	 */
	public function checkEmailExist($email)
	{
		$email = $this->getAdapter()->quote($email);
		$select = $this->select()->from($this, array("count" =>   
												new Zend_Db_Expr("count(1)")))
								->where("email=".$email);
		$row = $this->fetchRow($select);
		if( $row['count'] > 0) {
			return true;		
		}
		return false;
	}
}

